﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ExtAspNet;

namespace HY.WEB.PQ
{
    public partial class ht_comp_view : PageBase
    {
        public string whe = "", path = "", tab = "pq_ht";
        public string us, um, ubh;   
        protected void Page_Load(object sender, EventArgs e)
        {
            us = Session["ID"].ToString();
            um = Session["user"].ToString();
            ubh = Session["bh"].ToString();


            if (!IsPostBack)
            {
                if (!String.IsNullOrEmpty(Request["sid"]))
                {
                     hidsid.Text = Request["sid"].Trim();                
                }
                
                fill3();
                fill2();
            }

        
        }


       


        void fill3()
        {
            string dts; DateTime lastday;

            //BLL.PQ.pq_ht S = new BLL.PQ.pq_ht();
            //DataTable d = S.GetList().Tables[0];

            DataTable d = BLL.Bllbase.get_table("comp_ht", "sid=" + hidsid.Text);
            hidsbh.Text = d.Rows[0]["htbh"].ToString().Trim();
            txtht.Text = d.Rows[0]["htbh"].ToString().Trim();

            txtzsales.Text = d.Rows[0]["zsales"].ToString().Trim();

            ddlperson.Text = d.Rows[0]["pbh"].ToString();
            ddlcompany.Text =d.Rows[0]["pvendor"].ToString();

            ftype.Text = d.Rows[0]["ftype"].ToString().Trim();

            fbh.Text = d.Rows[0]["fbh"].ToString();
           
            dts = d.Rows[0]["sdate"].ToString().Trim();
            if (dts.Substring(0, 4) != "1900")
            {
                lastday = DateTime.Parse(dts);
                date1.Text = lastday.ToString("yyyy-M-d");
            }

            dts = d.Rows[0]["edate"].ToString().Trim();
            if (dts.Substring(0, 4) != "1900")
            {
                lastday = DateTime.Parse(dts);
                date2.Text = lastday.ToString("yyyy-M-d");
            }


            txtmoney.Text = d.Rows[0]["money"].ToString().Trim();
            txtworktype.Text = d.Rows[0]["work"].ToString().Trim();
            txtmemo.Text = d.Rows[0]["memo"].ToString().Trim();


        }

      

        void fill2()
        {
            string dts; DateTime lastday;

            BLL.PQ.comp_ht S = new BLL.PQ.comp_ht();
            DataTable d=  S.GetList("sid="+hidsid.Text).Tables[0];


            hidsbh.Text = d.Rows[0]["htbh"].ToString().Trim();
            txtht.Text = d.Rows[0]["htbh"].ToString().Trim();

            ddltype.Text =d.Rows[0]["httype"].ToString();

            ddlperson.Text =d.Rows[0]["pbh"].ToString();

            ddlcompany.Text =d.Rows[0]["pvendor"].ToString();


            dts = d.Rows[0]["sdate"].ToString().Trim();
            if (dts.Substring(0, 4) != "1900")
            {
                lastday = DateTime.Parse(dts);
                date1.Text = lastday.ToString("yyyy-M-d");
            }

            dts = d.Rows[0]["edate"].ToString().Trim();
            if (dts.Substring(0, 4) != "1900")
            {
                lastday = DateTime.Parse(dts);
                date2.Text = lastday.ToString("yyyy-M-d");
            }

            dts = d.Rows[0]["rdage"].ToString().Trim();
            if (dts.Substring(0, 4) != "1900")
            {
                lastday = DateTime.Parse(dts);
                regedate.Text = lastday.ToString("yyyy-M-d");
            }
            txtnum.Text = d.Rows[0]["snum"].ToString().Trim();

            txtmoney.Text =d.Rows[0]["money"].ToString().Trim();
            txtworktype.Text = d.Rows[0]["work"].ToString().Trim();
            txtmemo.Text = d.Rows[0]["memo"].ToString().Trim();   

        }
  
    
    }
}